﻿using IceCreamMachine.EventAggregators;
using Prism.Events;
using System;
using System.Threading.Tasks;

namespace IceCreamMachine.Services
{
    class IceCreamService2 : IceCreamServiceBase2
    {
        
      
        public override void AddChocolates()
        {
            Monitor.Message += $"\n {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 准备加 巧克力";
            EventAggregator.GetEvent<PubSubEvent<EnumMaterial>>().Publish(EnumMaterial.Chocolates);
            Task.Delay(1000 * 8).Wait();
            Monitor.Message += $"-> {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 巧克力 加完";
        }

        public override void AddIceCream()
        {
            Monitor.Message += $"\n {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 准备加 冰激凌";
            EventAggregator.GetEvent<PubSubEvent<EnumMaterial>>().Publish(EnumMaterial.IceCream);
            Task.Delay(1000 * 8).Wait();
            Monitor.Message += $"-> {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 冰激凌 加完";
        }

        public override void AddStrawberry()
        {
            Monitor.Message += $"\n {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 准备加 草   莓";
            EventAggregator.GetEvent<PubSubEvent<EnumMaterial>>().Publish(EnumMaterial.Strawberry);
            Task.Delay(1000 * 8).Wait();
            Monitor.Message += $"-> {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} 草   莓 加完";
        }
    }
}
